﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NuMvvm.Messaging;
using NUnit.Framework;

namespace NuMvvm.Tests
{
    [TestFixture]
    public class MessengerTest
    {
        [TestCase]
        public void SubscribeAndSend()
        {
            var messenger = Messenger.Default;

            var source = messenger;
            var target = messenger;

            TextMessage m = null;

            target.Subscribe<TextMessage>((message) =>
                    {
                        m = message;
                    });

            source.Send(new TextMessage("Hello"));

            Contract.Assume(m != null);

            Assert.IsNotNull(m);
        }
    }
}
